
#include "door_common.h"
#include "gkt_door.h"

typedef struct _door {
	gkt_door_notify_fn	notify;
} door_s;
static door_s s_door;

void door_inner_notify(uint32_t type, uint32_t status)
{
	gkt_info("door_inner_notify: type(%u), status(%u)\n", type, status);
	if (s_door.notify)
		(*s_door.notify)(type, status);
}

void gkt_door_register_notify(gkt_door_notify_fn notify)
{
	s_door.notify = notify;
}

int gkt_door_init(void)
{
	s_door.notify = NULL;

	door_lock_init();
#if defined(GKT_CONFIG_DOOR_MAGNETIC_ENABLE) && GKT_CONFIG_DOOR_MAGNETIC_ENABLE
	door_magnetic_init();
#endif
#if defined(GKT_CONFIG_DOOR_TAMPER_ENABLE) && GKT_CONFIG_DOOR_TAMPER_ENABLE
	door_tamper_init();
#endif
#if defined(GKT_CONFIG_DOOR_KEY_ENABLE) && GKT_CONFIG_DOOR_KEY_ENABLE
	door_key_init();
#endif
#if defined(GKT_CONFIG_DOOR_ADMIN_UNLOCK_ENABLE) && GKT_CONFIG_DOOR_ADMIN_UNLOCK_ENABLE
	door_admin_unlock_init();
#endif

	return GKT_SUCCESS;	
}


